<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录验证</title>
</head>
<body>
    <?php
    //  1903010328 获取用户的账号信息
    $uName = $_POST["username"];
    $uPa = md5($_POST["password"]);

    include "../inc/data/connAdmin.php";
    // 1903010328 登陆验证
    
    $sql = "select uname,upa
            from mamx_back 
            where uname = ? and upa = ?";
        
    if ($stmt = $conn->prepare($sql)) {
        $stmt->bind_param("si", $uName, $uPa);
        $stmt->execute();
        $stmt->bind_result($uName,$uPa);
        $stmt->store_result();
      
        // 1903010328 根据查询结果，提示跳转
        if ($stmt->fetch()) {
            # 匹配成功
            // 发放门票
            session_start();
            $_SESSION["uName"] = $uName;
            $_SESSION["uPa"] = $uPa;

            ?>
            <script type="text/javaScript">
            alert("<?=$uName?> ,欢迎你登录！");
            location = "admin.php";
            </script>
            <?php
        }
        else{
            # 匹配失败
            ?>
            <script type="text/javaScript">         
            alert("登陆信息有误！");
            location = "adminLogin.html";
            </script>
            <?php
        }
    }
    ?>
</body>
</html>